import axios from "axios";
import Vue from 'vue'
axios.defaults.baseURL = 'http://127.0.0.1:5000'

export default axios

export const padZero = (n) => {
    return n < 10 ? '0' + n : n;
}
// 转换时间格式
export const normalizeDate = (time, s = '-') => {
    let date = new Date(time)

    let y = date.getFullYear()
    let m = date.getMonth() + 1;
    let d = date.getDate()
    let h=date.getHours()
    let ms=date.getMinutes()
    let ss=date.getSeconds()

    return [y, m, d].map(v => padZero(v)).join(s)+' '+[h,ms,ss].map(v => padZero(v)).join(':')
}

//创建一个bus
export let bus=new Vue()